import { lazy } from "react";

const Home =lazy(()=>import("../pages/component/Home"))
const Cate =lazy(()=>import("../pages/component/Cate"))
const Cart =lazy(()=>import("../pages/component/Cart"))
const Uncenter =lazy(()=>import("../pages/component/Uncenter")) 
const NotFound =lazy(()=>import("../pages/NotFount"))
const GoodsList =lazy(()=>import("../pages/component/GoodsList"))
const GoodsDetail =lazy(()=>import("../pages/component/GoodsDetail"))
const Register =lazy(()=>import("../pages/component/Register"))
const Login =lazy(()=>import("../pages/component/Login"))
const Coupon =lazy(()=>import("../pages/component/Coupon"))

const rules=[
    {
        path:"/coupon",
        component:Coupon,
        exact:false,
        meta:{
            mustLogin:true,
            title: "优惠券"
        }
    },
    {
        path:"/login",
        component:Login,
        exact:false,
        meta:{
            mustLogin:false,
            title: "用户登录"
        }
    },
    {
        path:"/register",
        component:Register,
        exact:false,
        meta:{
            mustLogin:false,
            title: "用户注册"
        }
    },
    {
        path:"/gooddetail",
        component:GoodsDetail,
        exact:false,
        meta:{
            mustLogin:false,
            title: "商品详情"
        }
    },
    {
        path:"/goodlist",
        component:GoodsList,
        exact:false,
        meta:{
            mustLogin:false,
            title: "商品列表"
        }
    },
    {
        path:"/",
        redirect:"/home",
        exact:true,
        meta:{
            mustLogin:false,
        }
    },
    {
        path:"/home",
        component:Home,
        exact:false,
        meta:{
            mustLogin:false,
            title: "小ushop"
        }
    },
    {
        path:"/cart",
        component:Cart,
        exact:false,
        meta:{
            mustLogin:true,
            title: "购物车"
        }
    },
    {
        path:"/cate",
        component:Cate,
        exact:false,
        meta:{
            mustLogin:false,
            title: "购物车"
        }
    },
    {
        path:"/uncenter",
        component:Uncenter,
        exact:false,
        meta:{
            mustLogin:true,
            title: "个人中心"
        }
    },
    {
        path:"*",
        component:NotFound,
        exact:true,
        meta:{
            mustLogin:false,
            title: "页面找不到"
        }
    },
]
export default rules